﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

public partial class System_Controls_Common_EditorBar : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string _AppPath = Request.ApplicationPath;
        if (_AppPath == "/")
        {
            _AppPath = "";
        }
        lit_jQuery.Text = "<script src=\"" + _AppPath + "/Common/js/jquery.tools.min.js\" type=\"text/javascript\"></script>";
        pan_Edit.Visible = Page.User.Identity.IsAuthenticated;
    }
    protected void lib_ResetPage_Click(object sender, EventArgs e)
    {
        PersonalizationAdministration.ResetAllState(PersonalizationScope.Shared);
        PersonalizationAdministration.ResetAllState(PersonalizationScope.User);
    }
    protected void lib_ToggleScope_Click(object sender, EventArgs e)
    {
        this.wpm.Personalization.ToggleScope();
    }
    protected void ddl_Mode_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddl_Mode.SelectedValue == "Browse")
        {
            wpm.DisplayMode = WebPartManager.BrowseDisplayMode;
        }
        else if (ddl_Mode.SelectedValue == "Design")
        {
            wpm.DisplayMode = WebPartManager.DesignDisplayMode;
        }
        else if (ddl_Mode.SelectedValue == "Edit")
        {
            wpm.DisplayMode = WebPartManager.EditDisplayMode;
        }
        else if (ddl_Mode.SelectedValue == "Catalog")
        {
            wpm.DisplayMode = WebPartManager.CatalogDisplayMode;
        }
        else if (ddl_Mode.SelectedValue == "Connection")
        {
            wpm.DisplayMode = WebPartManager.ConnectDisplayMode;
        }
    }
}